<include file="public/layout" />
<body style="background-color: #FFF; overflow: auto;">
<div id="toolTipLayer" style="position: absolute; z-index: 9999; display: none; visibility: visible; left: 95px; top: 573px;"></div>
<div id="append_parent"></div>
<div id="ajaxwaitid"></div>
<div class="page">
    <div class="fixed-bar">
        <div class="item-title"><a class="back" href="javascript:history.back();" title="返回列表"><i class="fa fa-arrow-circle-o-left"></i></a>
            <div class="subject">
                <h3>财务管理 - 提现申请</h3>
                <h5>网站系统财务管理提现申请</h5>
            </div>
        </div>
    </div>
    <form class="form-horizontal" id="editForm" method="post">
        <input type="hidden" name="id" value="{$data.id}">
        <input type="hidden" name="user_id" value="{$data.user_id}">
        <input type="hidden" id="status" name="status" value="{$data[status]}">
        <div class="ncap-form-default">
            <dl class="row">
                <dt class="tit">
                    <label>用户id</label>
                </dt>
                <dd class="opt">
                    <a class="open" href="{:U('Admin/user/detail',array('id'=>$data[user_id]))}" target="blank">
                        {$data[user_id]}<i class="fa fa-external-link " title="新窗口打开"></i>
                    </a>
                </dd>
            </dl>
            <dl class="row">
                <dt class="tit">
                    <label>用户名</label>
                </dt>
                <dd class="opt">{$data.user_name}</dd>
            </dl>
            <dl class="row">
                <dt class="tit">
                    <label>用户平台余额</label>
                </dt>
                <dd class="opt"><strong class="red">{$user.user_money}</strong>元</dd>
            </dl>
            <dl class="row">
                <dt class="tit">
                    <label>申请提现金额</label>
                </dt>
                <dd class="opt"><strong class="red">{$data.money}</strong>元</dd>
            </dl>
            <dl class="row">
                <dt class="tit">
                    <label>申请提现银行</label>
                </dt>
                <dd class="opt">{$data.bank_name}</dd>
            </dl>
            <dl class="row">
                <dt class="tit">
                    <label>银行账号</label>
                </dt>
                <dd class="opt">{$data.account_bank}</dd>
            </dl>
            <dl class="row">
                <dt class="tit">
                    <label>银行账户名</label>
                </dt>
                <dd class="opt">{$data.account_bank}</dd>
            </dl>
            <dl class="row">
                <dt class="tit">
                    <label>申请时间</label>
                </dt>
                <dd class="opt">{$data.create_time|date="Y-m-d H:i",###}</dd>
            </dl>
            <dl class="row">
                <dt class="tit">
                    <label>状态</label>
                </dt>
                <dd class="opt">
                    <if condition="$data[status] eq 0">申请中</if>
                    <if condition="$data[status] eq 1">申请成功</if>
                    <if condition="$data[status] eq 2">申请失败</if>
                </dd>
            </dl>
            <dl class="row">
                <dt class="tit">备注</dt>
                <dd class="opt">
                    <textarea class="input-txt" rows="4" cols="60" id="remark" name="remark">{$data.remark}</textarea>
                    <span class="err"></span>
                    <p class="notic"></p>
                </dd>
            </dl>
            <dl class="row">
                <dt class="tit">
                    <label>提现流程</label>
                </dt>
                <dd class="opt">
                    1:用户前台申请提现<br/>
                    2:管理员审核生成转账记录 ( 生成时自动扣除用户平台余额 ) <br/>
                    3:财务转账给用户<br/>
                    或 2 , 3步可以调换,先转账后生成记录.<br/>
                </dd>
            </dl>
            <div class="bot">
                <if condition="in_array($data[status],array(0,2))">
                    <a href="JavaScript:void(0);" onclick="confirm_withdrawals();" class="ncap-btn-big ncap-btn-green">去生成转账记录</a>
                </if>
                <if condition="$data[status] eq 0">
                    <a href="JavaScript:void(0);" onclick="cancel_withdrawals();" class="ncap-btn-big ncap-btn-green">拒绝提现</a>
                </if>
                <if condition="in_array($data[status],array(0,2))">
                    <a href="JavaScript:void(0);" class="ncap-btn-big ncap-btn-green">修改备注</a>
                </if>

            </div>
        </div>
    </form>
</div>
<script type="text/javascript">
    // 确定提现
    function confirm_withdrawals()
    {
        if($.trim($('#remark').val()).length == 0)
        {
            layer.alert('请填写转账备注', {icon:2});
            return false;
        }
        layer.confirm('确定将从平台扣除用户余额￥{$data.money},确定吗?', {
                    btn: ['确定','取消'] //按钮
                }, function(){
                    // 确定
                    $('#status').val('1');
                    $('#editForm').submit();
                }, function(index){
                    layer.close(index);
                }
        );
    }
    // 拒绝提现
    function cancel_withdrawals()
    {
        if ($.trim($('#remark').val()).length == 0) {
            layer.alert('请填写拒绝备注', {icon: 2});
            return false;
        }
        layer.confirm('确定要拒绝用户提现吗?', {
                    btn: ['确定', '取消'] //按钮
                }, function () {
                    // 确定
                    $('#status').val('2');
                    $('#editForm').submit();
                }, function (index) {
                    layer.close(index);
                }
        );
    }
</script>
</body>
</html>